package pojo;

import java.util.HashSet;
import java.util.Set;

/**
 * Difficulty entity. @author MyEclipse Persistence Tools
 */

public class Difficulty implements java.io.Serializable {

	// Fields

	private String difficultyId;
	private String content;
	private String description;
	private Set modelDetails = new HashSet(0);
	private Set homeworkDifficulties = new HashSet(0);

	// Constructors

	/** default constructor */
	public Difficulty() {
	}

	/** minimal constructor */
	public Difficulty(String difficultyId, String content) {
		this.difficultyId = difficultyId;
		this.content = content;
	}

	/** full constructor */
	public Difficulty(String difficultyId, String content, String description,
			Set modelDetails, Set homeworkDifficulties) {
		this.difficultyId = difficultyId;
		this.content = content;
		this.description = description;
		this.modelDetails = modelDetails;
		this.homeworkDifficulties = homeworkDifficulties;
	}

	// Property accessors

	public String getDifficultyId() {
		return this.difficultyId;
	}

	public void setDifficultyId(String difficultyId) {
		this.difficultyId = difficultyId;
	}

	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Set getModelDetails() {
		return this.modelDetails;
	}

	public void setModelDetails(Set modelDetails) {
		this.modelDetails = modelDetails;
	}

	public Set getHomeworkDifficulties() {
		return this.homeworkDifficulties;
	}

	public void setHomeworkDifficulties(Set homeworkDifficulties) {
		this.homeworkDifficulties = homeworkDifficulties;
	}
	
	static public Set<Difficulty> formatToDifficulties(String str){
		str = str.substring(str.indexOf("{")+1,str.indexOf("}"));
		String[] strs = str.split(",");
		Set<Difficulty> res = new HashSet<Difficulty>();
		for(String s:strs){
			res.add(new Difficulty(s,""));
		}
		return res;
	}

}